#!/usr/bin/bash


update(){
  (
    cd "$(dirname "$0")"
    docker compose up -d
  )
}

log="/tmp/log.feiyang_allinone.log"

(
    if [ "2" -eq "$(date "+%w")" ];then
        mv "$log" "${log}.2"
    fi

)

{
  date
  #if docker pull youshandefeiyang/allinone | grep -F "Status: Image is up to date";then
  if docker pull youshandefeiyang/allinone | grep -F "Status: Downloaded newer image";then
	echo "[I] update"
	update
  else
	echo "[I] do nothing"
  fi
} >> "$log"


echo "cat '$log'"

